package com.lx.boot.es;

import com.lx.annotation.Note;
import com.lx.boot.config.annotation.Properties;
import com.lx.util.LX;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Properties(prefix = "server.es")
public class EsInfo{
    @Note("ES的host")
    @NotBlank(message = "es地址不能为空!")
    private String hosts;

    @Note("ES的用户名")
    private String username = "";

    @Note("ES的密码")
    private String password = "";

    @Note("是否配置的EsHosts")
    public boolean effective(){
        return LX.isNotEmpty(hosts);
    }
}
